//
//  UIImage+UIImage_WEIBO.m
//  OneWeiBo
//
//  Created on 6.
//   
//

#import "UIImage+WEIBO.h"

@implementation UIImage (UIImage_WEIBO)
+ (UIImage *)imageWithName:(NSString *)name
{
    if (ios7) {
        NSString *newName = [name stringByAppendingString:@"_os7"];
        UIImage *image = [UIImage imageNamed:newName];
        // 没有ios7图片
        if (image == nil) {
            image = [UIImage imageNamed:name];
        }
        return image;
    }
    // 非ios7
    UIImage *image = [UIImage imageNamed:name];
    return image;
}

+ (UIImage *)resizedImageWithName:(NSString *)name left:(CGFloat)left top:(CGFloat)top
{
    UIImage *image = [UIImage imageWithName:name];
    return [image stretchableImageWithLeftCapWidth:image.size.width*left topCapHeight:image.size.height*top];
}

+ (UIImage *)resizedImageWithName:(NSString *)name
{
    UIImage *image = [UIImage imageWithName:name];
    return [image stretchableImageWithLeftCapWidth:image.size.width*0.5 topCapHeight:image.size.height*0.5];
}

@end
